package com.resou.reader.reader.adpter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.resou.reader.R;
import com.resou.reader.api.entry.BookDetailBean;

import java.util.List;

public class EndBookAdapter extends BaseQuickAdapter<BookDetailBean, BaseViewHolder> {

    public EndBookAdapter(int layoutResId, @Nullable List<BookDetailBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BookDetailBean item) {
        RequestOptions options = new RequestOptions();
        options.format(DecodeFormat.PREFER_RGB_565);
        Glide.with(mContext).load(item.getCoverUrl() + "").apply(options).into((ImageView) helper.getView(R.id.ivBookpic));
        helper.setText(R.id.tvBookName, item.getNovelName() + "")
                .addOnClickListener(R.id.llOnclickListener);
    }
}
